﻿// *----------------------------------------------------------------
// Copyright (C) 2017 通通优品
// 版权所有。
// 
// 类名：MallWebApplicationModule.cs
// 功能描述：TongTongMall.MallWeb.Application
// 
// Create User：jym 2017/02/09
// 
// Edit User：UserName,EditTime
// Describe：Describe
// ----------------------------------------------------------------*/
using System;
using System.Reflection;
using TongTongMall.Common;
using TongTongMall.Dependecy;
using TongTongMall.MallWeb.Application.Configuration.Session;
using TongTongMall.MallWeb.Application.Users.Mapper;
using TongTongMall.MallWeb.Core;
using TongTongMall.Modules;

namespace TongTongMall.MallWeb.Application
{
    [DependsOn(
      typeof(MallWebCoreModule),
      typeof(CommonModule))]
    public class MallWebApplicationModule : BaseModule
    {
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }

        public override void PreInitialize()
        {
            IocManager.RegisterIfNot<IMallWebSession, MallWebSession>(DependencyLifeStyle.Singleton);
        }

        public override void PostInitialize()
        {
            InitializeMapper();
        }

        private void InitializeMapper()
        {
            //mapper转换
            StartupUserMapper.Initialize();
        }
    }
}
